<?php
namespace app\model\user;

use think\Model;

class ZxlKnowStoreLikeLogModel extends Model
{
    protected $name = 'zxl_know_store_like_log';

    /**
     * 当前评论是否点赞
     * 
     * @param $type 1 文章 2 文章评论 3考试记录
     * @return int
     */
    public static function isLike($comment_id, $user_id, $type = 3){
        $count = self::where(['target_id' => $comment_id, 'like_type' => $type, 'user_id' => $user_id])->count();
        return $count > 0 ? 1 : 0;
    }
}